<?php
$USERNAME = "06160f5dd7e447f3ac2a912d70316497"; //Access ID
$PASSWORD = "b30b2c61367443599560139cd358063c"; //Access Key
$SERVICE_URL = "https://ws.orbitzworldwide.com/xml/service";

$XML = '<?xml version="1.0" encoding="UTF-8"?>
<AirShoppingRequest xmlns="http://ws.orbitz.com/schemas/2008/Air">
    <PointOfSale>EBNL</PointOfSale>
    <Travelers>
        <Adults>1</Adults>
    </Travelers>
    <Slices preferNonStop="false" refundableOnly="false">
        <CabinType code="C"/>
        <Slice>
            <Departure>
                <Airport code="AMS"/>
                <Date>2012-11-08</Date>
            </Departure>
            <Arrival>
                <Airport code="IBZ"/>
            </Arrival>
        </Slice>
        <Slice>
            <Departure>
                <Airport code="IBZ"/>
                <Date>2012-11-18</Date>
            </Departure>
            <Arrival>
                <Airport code="AMS"/>
            </Arrival>
        </Slice>
    </Slices>
</AirShoppingRequest>';

$lengh = strlen($XML);
 
$HEADERS = array(	'Accept: */*',
                        'Content-Type: application/xml; charset=utf-8',
                        "Content-Length: $lengh"
				); 

// The usual - init a curl session and set the url
$ch = curl_init($SERVICE_URL); //curl header
//curl_setopt($ch, CURLOPT_URL, $SERVICE_URL); //did not work

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPHEADER, $HEADERS ); 

// Set your login and password for authentication
curl_setopt($ch, CURLOPT_USERPWD, "$USERNAME:$PASSWORD");

// You can use CURLAUTH_BASIC, CURLAUTH_DIGEST, CURLAUTH_GSSNEGOTIATE,
// CURLAUTH_NTLM, CURLAUTH_ANY, and CURLAUTH_ANYSAFE
//
// You can use the bitwise | (or) operator to combine more than one method.
// If you do this, CURL will poll the server to see what methods it supports and pick the best one.
//
// CURLAUTH_ANY is an alias for CURLAUTH_BASIC | CURLAUTH_DIGEST |
// CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM
//
// CURLAUTH_ANYSAFE is an alias for CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE |
// CURLAUTH_NTLM
//
// Personally I prefer CURLAUTH_ANY as it covers all bases
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);

// This is occassionally required to stop CURL from verifying the peer's certificate.
// CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if
// CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2 - check the existence of a
// common name and also verify that it matches the hostname provided)
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// Optional: Return the result instead of printing it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $XML); 

// The usual - get the data and close the session
$data = curl_exec($ch);
curl_close($ch); 

header('Content-Type: application/xml; charset=UTF-8');
print $data;

?>